package com.smartlink.app.util;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * 数据库操作类
 * Created by Administrator on 2016/7/11.
 */
public class DatabaseHelper extends SQLiteOpenHelper {
    private static final int DATA_BASE_VERSION = 1;
    private static final String DATA_BASE_NAME = "smartlink";
    private static final String CREATE_TABLE = "CREATE TABLE class_room_info (id INTEGER PRIMARY KEY AUTOINCREMENT,class_room_id INTEGER,bluetooth TEXT,class_room_name TEXT)";
    private static final String DROP_TABLE = "DROP TABLE IF EXISTS class_room_info";


    public DatabaseHelper(Context context) {
        super(context, DATA_BASE_NAME, null, DATA_BASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_TABLE);

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL(DROP_TABLE);
        onCreate(db);

    }

    @Override
    public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        onUpgrade(db, oldVersion, newVersion);
    }
}
